//#define _CRT_SECURE_NO_WARNINGS 1
//
#include"list.h"

void test()
{
	stl::list<int> lt;
	lt.push_back(1);
	lt.push_back(2);
	lt.push_back(3);
	lt.push_back(5);
	auto it = lt.begin();
	while (it != lt.end())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;

	for (auto i : lt)
	{
		cout << i << " ";
	}
	cout << endl;
	
	lt.print(lt);
}

void test1()
{
	list<int> lt;
	vector<int> v;

	srand((unsigned int)time(nullptr));
	const int N = 1000000;
	v.reserve(N);

	for (auto i = 0; i < N; ++i)
	{
		auto e = rand();
		lt.push_back(e);
		v.push_back(e);
	}
	int begin1 = clock();
	lt.sort();
	int end1 = clock();
	cout << "List_Time: " << end1 - begin1 << endl;

	int begin2 = clock();
	sort(v.begin(),v.end());
	int end2 = clock();
	cout << "Vector_Time: " << end2 - begin2 << endl;

}

struct A
{
	A(int x = 0, int y = 0)
		: _m(x)
		, _n(y)
	{
	}
	int _m;
	int _n;
};

void test2()
{
	stl::list<A> lt;
	lt.push_back(A(1, 5));
	lt.push_back(A(2, 4));
	lt.push_back(A(3, 3));
	lt.push_back(A(4, 2));
	auto it = lt.begin();
	while (it != lt.end())
	{
		cout << (*it)._m << " ";
		cout << (*it)._n << endl;
		++it;
	}
	cout << endl;
}

void test3()
{
	stl::list<int> lt;
	lt.insert(lt.begin(), 1);
	lt.insert(lt.begin(), 4);
	lt.insert(lt.begin(), 3);
	lt.insert(lt.begin(), 5);
	auto it = lt.begin();
	while (it != lt.end())
	{
		cout << *it << " ";
		++it;
	}
	cout << endl;

	for (auto i : lt)
	{
		cout << i << " ";
	}
	cout << endl;

	lt.print(lt);
}

int main()
{
	//test();
	//test1();
	//test2();
	test3();
	return 0;
}